*** Analysis of updated NDC data ***

//recoding variables
// type of target
gen type_target=type_of_target_class
recode type_target (0=.) (6=0) (4=1) (3=2) (5=3) (2=4) (1=5)

//cost 0 og 1 er 1, resten null
recode costs_of_ccm_class (0=.) (2 3 4 5 6=0) (1=1)

//reducing_non_co2_gases_class
recode reducing_non_co2_gases_class (0=.) (2=0) (1=1)

//conditionality_of_mitigation_fin
recode conditionality_of_mitigation_fin (0=.) (1=0) (2=1) (3=2) (4=3)

//conditionality_of_technology_tra
recode conditionality_of_technology_tra (0=.) (1=0) (2=1) (3=2)

//conditionality_of_capacity_build
recode conditionality_of_capacity_build (0=.) (1=0) (2=1) (3=2)

//standardizing the variables
egen costs_of_ccm_class_z=std(costs_of_ccm_class)
egen type_target_z=std(type_target)
egen reducing_non_co2_gases_class_z=std(reducing_non_co2_gases_class)
egen conditionality_of_fin_z=std(conditionality_of_mitigation_fin)
egen conditionality_of_tra_z=std(conditionality_of_technology_tra)
egen conditionality_of_build_z=std(conditionality_of_capacity_build)


//renaming democracy
rename Democracy_index v2x_mpi_2015

//destring controls
replace v2x_mpi_2015="." if v2x_mpi_2015=="NA"
replace vulnerability_2015="." if vulnerability_2015=="NA"
replace coal_rents_2015="." if coal_rents_2015=="NA"
replace oil_rents_2015="." if oil_rents_2015=="NA"
replace natural_gas_rents_2015="." if natural_gas_rents_2015=="NA"
replace GDP_ppp_2015_log="." if GDP_ppp_2015_log=="NA"

destring GDP_ppp_2015_log v2x_mpi_2015 vulnerability_2015 coal_rents_2015 oil_rents_2015 natural_gas_rents_2015, replace


//turn around ambition Du_Pont_Ambition
destring Dupont_2, replace
replace Dupont_2=5.1-Dupont_2

**** Making the indexes ******
// Unweighted index
gen index=costs_of_ccm_class + type_target + reducing_non_co2_gases_class + conditionality_of_mitigation_fin + conditionality_of_technology_tra + conditionality_of_capacity_build

//factor analysis
pca costs_of_ccm_class type_target reducing_non_co2_gases_class conditionality_of_mitigation_fin conditionality_of_technology_tra conditionality_of_capacity_build

predict f1, score


***** Table C.10: Conditional effect of democracy on the ambiguity-ambition nexus: using data from updated NDCs
//unweighted index
gen transamb=index*v2x_mpi_2015

local control "GDP_ppp_2015_log vulnerability_2015 coal_rents_2015 oil_rents_2015 natural_gas_rents_2015"

reg Dupont_2 index transamb v2x_mpi_2015 `control',r 
eststo b1

//pca
gen transamb1=f1*v2x_mpi_2015

local control "GDP_ppp_2015_log vulnerability_2015 coal_rents_2015 oil_rents_2015 natural_gas_rents_2015"

reg Dupont_2 f1 transamb1 v2x_mpi_2015 `control',r 
eststo b2

cd "$path/Figures and Tables"

esttab  b1 b2  using TableC10.tex, noconstant se  label star( * 0.10 ** 0.05 *** 0.010) ///
title("Conditional effect of democracy on the ambiguity-ambition nexus: using data from updated NDCs") ///
 nodepvars nomtitles  ///
gap eqlabels(none) collabels(,lhs(Dep Var: NDC Ambition)) replace


